IMPLEMENTATION MODULE Tad_CargaDatos;

FROM libc IMPORT exit, printf;
FROM MathLib0 IMPORT sqrt;
FROM FpuIO IMPORT WriteReal;
FROM StrIO IMPORT WriteString, WriteLn;
FROM Scan IMPORT OpenSource;
FROM NumberIO IMPORT ReadInt, WriteInt;
FROM FIO IMPORT OpenToRead, File, EOF, ReadString;
FROM DynamicStrings IMPORT String, Slice, CopyOut, Index, InitString;
FROM StringConvert IMPORT StringToInteger;

PROCEDURE Carga_Lineas(VAR n:INTEGER; VAR m:INTEGER; VAR o:INTEGER; VAR p:INTEGER; data:File);
VAR valido: BOOLEAN;
VAR string,a,b,c,d : String;
VAR linea: ARRAY [0..200] OF CHAR;
VAR inic,fin,i : CARDINAL;
 BEGIN
	valido := TRUE;
    inic := 0;
    ReadString(data, linea);
    string := InitString(linea);
    fin := Index(string," ",inic);
	a := Slice(string,inic,fin);
	n := StringToInteger(a,10,valido);
	inic := fin + 1;
	fin := Index(string," ",inic);
	b := Slice(string,inic,fin);
	m := StringToInteger(b,10,valido);
	inic := fin + 1;
	fin := Index(string," ",inic);
	c := Slice(string,inic,fin);
	o := StringToInteger(c,10,valido);
	inic := fin + 1;
	fin := 0;
	d := Slice(string,inic,fin);
	p := StringToInteger(d,10,valido);
  END Carga_Lineas;
  
PROCEDURE CargaLinea(data:File) : INTEGER;
VAR string  : String;
VAR linea : ARRAY [0..200] OF CHAR;
VAR num : INTEGER;
VAR valido : BOOLEAN;
BEGIN
	valido := TRUE;
	ReadString(data,linea);
    string := InitString(linea);
    num := StringToInteger(string,10,valido);
    
	RETURN num;
END CargaLinea;


END Tad_CargaDatos.
